Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting direct access to base class state (4th defect type) #48

Merged
merged 20 commits into from
May 15, 2022

Conversation

Leosimetti
Copy link
Contributor

@Leosimetti Leosimetti commented Apr 3, 2022

This PR contains the following changes:

  1. Implementation of the analyzer for the 4th defect type;
  2. Corresponding Unit-tests of the functionality;
  3. API for polystat.

Example of the defect

The proper way to change the state in the subclass b would be:

[] > a
  memory > state
  [self new_state] > update_state
    seq > @
      state.write new_state
      state
[] > b
  a > @
  [self new_state] > change_state_plus_two
    new_state.add 2 > tmp
    seq > @
      self.update_state self tmp
      state

An improper way to achieve the same functionality in subclass bad:

[] > a
  memory > state
  [self new_state] > update_state
    seq > @
      self.state.write new_state
      self.state
[] > bad
  a > @
  [self new_state] > change_state_plus_two
    seq > @
      self.state.write (new_state.add 2) 
      self.state

More detailed information about the problem statement and implementation is available here.

fizruk
fizruk previously approved these changes Apr 4, 2022
@fizruk
Copy link
Member

fizruk commented Apr 4, 2022

Please, add example(s) with explanation to the description of the PR.

@Leosimetti Leosimetti force-pushed the direct_access_to_state_defect branch from 690cacc to 3722747 Compare May 8, 2022 19:11
nikololiahim
nikololiahim previously approved these changes May 15, 2022
@nikololiahim nikololiahim merged commit 017746d into master May 15, 2022
@nikololiahim nikololiahim deleted the direct_access_to_state_defect branch May 15, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants